<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>我的地址</title>
    <script type="text/javascript" src="/js/jquery.js"></script>
</head>
<body>

<div>
    <ul id="J_list">

    </ul>
</div>
<script>
    $(function(){
       getAddressList();

    });

    function getAddressList(){
        var uid = "${uid}";
        var data = {uid:uid};
        var url = "/address/get_address";
        $.ajax({
            type: "POST",
            dataType: 'json',
            async: false,
            contentType: "application/json; charset=utf-8",
            data: JSON.stringify(data),
            url: url,
            success: function(res){
                if(res.code == "200"){
                    console.log(res.data);
                    var list= res.data;
                    if(list.length>0){
                        for (var i =0;i<list.length;i++){
                            var shtml = '<li><a href="" data-id="'+list[i]['id']+'"><div>'+list[i]['name']+list[i]['phone']+'</div><div>'+list[i]['address']+'</div></a></li>';
                            $("#J_list").append(shtml);
                        }
                    }
                }else{
                    alert(res.msg);
                }
            },
            error: function(){

            },
            complete: function(){
            }
        });
    }
</script>
</body>
</html>
